#include "sdk.h"
#include "todosettingsdlg.h"

ToDoSettingsDlg::ToDoSettingsDlg( wxWindow* parent ) {
  wxXmlResource* xml_res = wxXmlResource::Get();
  wxString resPath = ConfigManager::GetDataFolder() + _T( "/ToDo_Settings.xrc" );
  xml_res->Load( resPath );
  if( !xml_res->LoadPanel( this, parent, _T( "ToDoSettingsDlg" ) ) ) {
    return;
  }
  bool checked = Manager::Get()->GetConfigManager( _T( "todo_list" ) )->ReadBool( _T( "auto_refresh" ), true );
  XRCCTRL( *this, "chkAutoRefresh", wxCheckBox )->SetValue( checked );
}

ToDoSettingsDlg::~ToDoSettingsDlg() {
}

void ToDoSettingsDlg::OnApply() {
  bool checked = XRCCTRL( *this, "chkAutoRefresh", wxCheckBox )->GetValue();
  Manager::Get()->GetConfigManager( _T( "todo_list" ) )->Write( _T( "auto_refresh" ), checked );
}
